var timer;
window.onload = function() {
	var liarray = document.getElementById("lunbo").childNodes;//获取所有的li,下面为他们注册事件
	lunbo(liarray);//开始轮播
	for ( var i = 0; i < liarray.length; i++) {
		liarray[i].onmouseover = function()//注册onmouseover事件
		{
			clearInterval(timer);//清除时钟
			var j = parseInt(this.innerHTML) - 1; //获取li的指
			document.getElementById("content").style.top = (-j * 319) + "px";
			for ( var n = 0; n < liarray.length; n++)
				liarray[n].style.background = "white";
			    this.style.background = "grey";
		}

		liarray[i].onmouseout = function()//注册onmouseout事件 
		{
			lunbo(liarray, this.innerHTML);
		}
	}
}
//轮播函数对象，（闭包实现）
function lunbo(liarray, linow) {
	//获取li节点数组长度
	var length = liarray.length;
	if (linow)
		var i = linow - 1;
	else
		i = 0;
	//将li背景色全部赋值同色
	for ( var n = 0; n < liarray.length; n++)
		liarray[n].style.background = "white";
	document.getElementById("content").style.top = (-i * 319) + "px";
	function autoshow() {
		if (i + 2 > length)
			i = 0;
		else
			i = i + 1;
		//将li背景色全部赋值同色	 
		for ( var n = 0; n < liarray.length; n++)
			liarray[n].style.background = "white";
		document.getElementById("content").style.top = (-i * 319) + "px";
		liarray[i].style.background = "grey";
	}
	//设置计时器
	timer = setInterval(autoshow, 1800);
	if (result != 'null' && result != undefined) {
		alert(result);
	}
}
// JavaScript Document